package com.feng.study.demo.string;

import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
 * @Author: Zeng ShaoYong
 * @Date: 2021-11-03
 * @Description:
 */
public class StringDemo {
    public static void main(String[] args) {
        testJoin();

        String str="  asdf  dd f DFG  ";
        String s = str.replaceAll(" ", "");
        System.out.println(s);
        System.out.println(str);
    }
    private static void testOptional(){
        List<Integer> list= new ArrayList<>();
        List<Integer> list1 = Optional.ofNullable(list).orElse(Collections.emptyList());
    }

    private static void testJoin(){
        ArrayList<String> arrayList = Lists.newArrayList("aaa", "bbb", "ccc");
        String join = StringUtils.join(arrayList.toArray(), "@");
        System.out.println(join);
    }
}
